package com.soilflow.know.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.soilflow.common.domain.KnowsInfoReplies;
import com.soilflow.common.domain.dto.KnowsInfoRepliesDto;
import com.soilflow.common.domain.vo.KnowsInfoRepliesVo;
import com.soilflow.common.utils.bean.BeanUtils;
import com.soilflow.know.mapper.KnowsInfoRepliesMapper;
import com.soilflow.know.service.KnowsInfoRepliesService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class KnowsInfoRepliesServiceImpl extends ServiceImpl<KnowsInfoRepliesMapper, KnowsInfoReplies> implements KnowsInfoRepliesService {
    /* 查询【百事通信息回复】
     *
     * @param id 【百事通信息回复】主键
     * @return 【百事通信息回复】
     */
    @Override
    public KnowsInfoRepliesVo selectKnowsInfoRepliesById(Long id) {
        KnowsInfoRepliesVo landInfoVos = this.baseMapper.selectKnowsInfoRepliesById(id);
        return landInfoVos;
    }
    /**
     * 查询【百事通信息回复】列表
     *
     * @param dto 【百事通信息回复】
     * @return 【百事通信息回复】集合
     */
    @Override
    public List<KnowsInfoRepliesVo> selectKnowsInfoRepliesList(KnowsInfoRepliesDto dto) {
        List<KnowsInfoRepliesVo> landInfoVos = this.baseMapper.selectKnowsInfoRepliesList(dto);
        return landInfoVos;
    }
    /**
     * 新增【百事通信息回复】
     *
     * @param dto 【百事通信息回复】
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertKnowsInfoReplies(KnowsInfoRepliesDto dto) {
        boolean save =false;
        KnowsInfoReplies landInfo = new KnowsInfoReplies();
        BeanUtils.copyProperties(dto,landInfo);
        save = this.save(landInfo);
        return save;
    }
    /**
     * 修改【百事通信息回复】
     *
     * @param dto 【百事通信息回复】
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateKnowsInfoReplies(KnowsInfoRepliesDto dto) {
        boolean save =false;
        KnowsInfoReplies landInfo = new KnowsInfoReplies();
        BeanUtils.copyProperties(dto,landInfo);
        //修改百事通信息回复
        save = this.updateById(landInfo);
        return save;
    }
    /**
     * 批量删除【百事通信息回复】
     *
     * @param ids 需要删除的【百事通信息回复】主键集合
     * @return 结果
     */
    @Override
    public Boolean deleteKnowsInfoRepliesByIds(List<Long> ids) {
        return this.removeByIds(ids);
    }
}
